Skip to content

SlideAnimation

Base classes

Name Children Inherits
PropertyAnimation
prettyqt.core.propertyanimation
Animates Qt properties.

⋔ Inheritance diagram

graph TD
  1610195842["animations.SlideAnimation"]
  4280009853["core.PropertyAnimation"]
  2400666939["core.VariantAnimationMixin"]
  565069530["core.AbstractAnimationMixin"]
  3227531497["core.ObjectMixin"]
  2751680898["builtins.object"]
  3508266353["QtCore.QPropertyAnimation"]
  2420859519["QtCore.QVariantAnimation"]
  2133980439["QtCore.QAbstractAnimation"]
  3984060476["QtCore.QObject"]
  37984305["Shiboken.Object"]
  4280009853 --> 1610195842
  2400666939 --> 4280009853
  565069530 --> 2400666939
  3227531497 --> 565069530
  2751680898 --> 3227531497
  3508266353 --> 4280009853
  2420859519 --> 3508266353
  2133980439 --> 2420859519
  3984060476 --> 2133980439
  37984305 --> 3984060476
  2751680898 --> 37984305

🛈 DocStrings

Bases: PropertyAnimation

Source code in prettyqt/animations/slideanimation.py
class SlideAnimation(core.PropertyAnimation):
    ID = "slide"

    def __init__(
        self,
        parent: QtWidgets.QWidget,
        duration: int = 1000,
        start: tuple[int, int] | core.Point = (0, 0),
        end: tuple[int, int] | core.Point = (0, 0),
        easing: core.easingcurve.TypeStr = "in_out_sine",
    ):
        super().__init__(parent)
        self.set_easing(easing)
        self.set_start_value(start)
        self.set_end_value(end)
        self.setDuration(duration)

    def set_start_value(self, point: datatypes.PointType):
        offset = datatypes.to_point(point)
        pos = self.parent().geometry().topLeft()
        self.setStartValue(pos + offset)

    def set_end_value(self, point: datatypes.PointType):
        offset = datatypes.to_point(point)
        pos = self.parent().geometry().topLeft()
        self.setEndValue(pos + offset)

    def apply_to(self, obj: QtWidgets.QWidget | Callable):
        if isinstance(obj, QtWidgets.QWidget):
            obj = obj.pos
        super().apply_to(obj)

:fa-brands-github: Show source on GitHub